System and method for computing, applying, and displaying document deltas

ABSTRACT

Systems and methods are disclosed herein for computing, applying, and displaying document deltas. Snapshots are stored of documents, and the stored snapshots are flattened. Deltas of the flattened snapshots are computed. The deltas are converted to representations of changes in the document by inverting the flattening. The representations of changes are displayed to a user via a feed. Users of the systems and methods can accept, reject, and comment on the changes.

RELATED APPLICATION

This application is a continuation application of U.S. patentapplication Ser. No. 14/645,072 filed Mar. 11, 2015, which claimsbenefit to U.S. Provisional Application Ser. No. 61/954,818 filed Mar.18, 2014, the entire contents of both are hereby incorporated byreference.

BACKGROUND

Collaborative content creation (e.g., collaborative document creationand editing) presents a number of technical challenges, not the least ofwhich is the computing, application and displaying of differences (ordeltas) between versions of content. In particular, where a number ofcollaborators are contributing towards content creation over time, theability to compute and communicate information regarding content deltas(e.g., who made which changes and when) presents a number of computingand person-machine interface technical challenges.

SUMMARY

Accordingly, systems and methods are described herein for computing,applying, and displaying document deltas. In certain aspects, thesystems and methods described herein relate to flattening documentsnapshots, and comparing the flattened one-dimensional documentsnapshots. A first snapshot of the collaborative document is stored. Anedit to the collaborative document is received from a first user, andthe collaborative document is modified based on the first edit. A secondsnapshot of the modified collaborative document is stored. The firstsnapshot is flattened into a first one-dimensional string to result in afirst flattened snapshot. The second snapshot is flattened into a secondone-dimensional string to result in a second flattened snapshot. Asmallest subset of the second flattened snapshot that is different froma corresponding subset of the first flattened snapshot is determined. Afeed comprising a representation of the determined smallest subset isgenerated, and the feed is sent to a client device for display on theclient device.

In some aspects, a new portion may be generated by inverting theflattening of the determined smallest subset, and an old portion may begenerated by inverting the flattening of the corresponding subset. Insome aspects, the feed comprises a context portion of the electronicdocument that is common to the first and second snapshots.

In some aspects, a comment is received from one of the first and secondusers. The feed is modified to include a representation of the comment,and the modified feed is sent to the client device for display on theclient device.

In some aspects, a second edit to the modified collaborative document isreceived from a second user. The modified collaborative document isfurther modified based on the second edit. A third snapshot of thefurther modified collaborative document is stored. The third snapshot isflattened into a third one-dimensional string to result in a thirdflattened snapshot. A second smallest subset of the third flattenedsnapshot that is different from a corresponding subset of the secondflattened snapshot is determined. The feed is modified to include arepresentation of the second smallest subset. The feed is sent to aclient device for display on the client device.

In some aspects, the first snapshot is flattened into a fourthone-dimensional string to result in a fourth flattened snapshot. Thesecond snapshot is flattened into a fifth one-dimensional string toresult in a fifth flattened snapshot. A third smallest subset of thefifth flattened snapshot that is different from a corresponding subsetof the fourth flattened snapshot is determined. In some aspects, thedetermined smallest subset is the third smallest subset.

In some aspects, the collaborative document is a spreadsheet document.The fourth and fifth one-dimensional string each contain a plurality ofidentifiers, and each of the identifiers represents a row in thespreadsheet document.

In some aspects, each snapshot of the collaborative document comprises ahierarchy of nodes including a plurality of levels, one master nodecontaining data, and a plurality of non-master nodes containing data.Each of the non-master nodes has a parent node in the level above, andeach of the nodes has zero, one, or more child nodes in the level below.The number of levels between each node in a level and the master node isthe same. Flattening the first snapshot into the first one-dimensionalstring comprises selecting a level, mapping a first node in the selectedlevel to a first identifier, and adding the first identifier to thefirst one-dimensional string. In some aspects, flattening the secondsnapshot into the second one-dimensional string comprises mapping asecond node in the corresponding selected level of the second snapshotto the first identifier, based on a determination that the contents ofthe second node are the same as the contents of the first node, andadding the first identifier to the second one-dimensional string.

In some aspects, flattening the second snapshot into the secondone-dimensional string further comprises mapping a third node in thecorresponding selected level of the second snapshot to a secondidentifier, based on a determination that the data contained in thethird node are different from the contents of any of the nodes in theselected level of the first snapshot, and adding the second identifierto the second one-dimensional string.

In some aspects, determining the smallest subset comprises determiningthat the first and second one-dimensional strings contain the firstidentifier and excluding the first identifier from the smallest subset.

In some aspects, determining the smallest subset comprises determiningthat the first one-dimensional string does not contain the secondidentifier and including the second identifier in the smallest subset.

BRIEF DESCRIPTION OF THE DRAWINGS

The above and other features of the present disclosure, including itsnature and its various advantages, will be more apparent uponconsideration of the following detailed description, taken inconjunction with the accompanying drawings in which:

FIG. 1 is a block diagram of system for computing, applying, anddisplaying document deltas, according to an illustrative implementation;

FIG. 2 is a block diagram of a cloud computing service, according to anillustrative implementation;

FIG. 3 is a block diagram of a document object model, according to anillustrative implementation;

FIG. 4 depicts snapshots and flattened snapshots of a document,according to an illustrative implementation;

FIG. 5 depicts snapshots of a spreadsheet document, according to anillustrative implementation;

FIG. 6 depicts operation of a document flattening module, according toan illustrative implementation;

FIG. 7 depicts row-wise sets and column-wise sets of flattenedsnapshots, according to an illustrative implementation;

FIG. 8 depicts snapshots of a spreadsheet document, according to anillustrative implementation;

FIG. 9 depicts the operation of a document flattening module, accordingto an illustrative implementation;

FIG. 10 depicts row-wise sets and column-wise sets of flattenedsnapshots, according to an illustrative implementation;

FIG. 11 depicts a flowchart of a method to compute deltas between wordprocessing documents and a flowchart of a method to compute deltasbetween spreadsheet documents, according to an illustrativeimplementation;

FIG. 12 depicts a user interface displaying a summary of two chunks of adocument, according to an illustrative implementation;

FIGS. 13A and 13B depict examples in which rows and columns have beenstripped after performing row and column-wise comparisons, according toan illustrative implementation;

FIG. 14 depicts a system for computing and caching deltas for documentsstored in cloud storage, according to an illustrative implementation;

FIG. 15 depicts a feed which contains a summary of changes to adocument, according to an illustrative implementation;

FIG. 16 depicts two user interfaces, according to an illustrativeimplementation;

FIG. 17 depicts a user interface that shows an increased level ofcontext for faster user interpretation, according to an illustrativeimplementation;

FIG. 18 depicts a user interface that shows a subset of a change,according to an illustrative implementation;

FIG. 19 depicts a user interface as output by a user interface moduleand rendered for display on a mobile device, according to anillustrative implementation;

FIG. 20 depicts a user interface showing changes to a spreadsheetdocument, according to an illustrative implementation;

FIG. 21 depicts a user interface that is configured to allow a user tocontrol whether to accept or reject changes or deltas, according to anillustrative implementation;

FIG. 22 depicts an example in which a document comparison module invertsdeltas, according to an illustrative implementation;

FIG. 23 depicts change menus, according to an illustrativeimplementation;

FIG. 24 depicts a mapping of bits used to store metadata, according toan illustrative implementation;

FIG. 25 depicts a flowchart of a method used by the document comparisonsystem to compute deltas and generate a feed for display to a user,according to an illustrative implementation;

FIG. 26 is a block diagram illustrating an architecture of mobile devicesoftware, according to an illustrative implementation; and

FIG. 27 is a block diagram of a machine in the example form of acomputer system.

DETAILED DESCRIPTION OF THE DRAWINGS

In the following description, for purposes of explanation, numerousspecific details are set forth in order to provide a thoroughunderstanding of some examples. It will be evident, however, to oneskilled in the art that the present invention may be practiced withoutthese specific details. For example, while examples herein are discussedwith specific reference to documents and spreadsheets, the methods andsystems described herein may equally well be applied to other types ofcontent.

With collaborative cloud based documents, changes may be made frequentlyby multiple users. It can be technically challenging to compute,identify and display what was changed and by whom. Systems and methodsare described herein for presenting these document (or content) changesin a human-readable and succinct manner. The example method is wellsuited for presentation in a “news feed,” e-mail summaries, mobileapplications, and other use cases where screen real-estate is limited.Such uses cases would enable a user to quickly gather what has changedover many documents and numerous authors without needing to open thedocument and search for what has changed. The systems and methodsdescribed herein are applicable to any document content type including,but not limited to, word processing documents, spreadsheet documents,presentation documents, form documents, database documents, web pagedocuments and plain text documents. The systems and methods describedherein may offer to the user succinct and human-readable summaries,contextual relevance, and usability across multiple devices and screenresolutions.

The various algorithms described herein may be implemented within thecontext of a document comparison system as shown in FIG. 1, according toone example. FIG. 1 depicts a document server 102 communicativelycoupled, via a network 110, to client devices 104 a and 104 b and adocument comparison system 120. The document server 102 is alsocommunicatively coupled to document storage 108. The document comparisonsystem 120 is communicatively coupled to a delta repository 140 a, inwhich is stored delta (e.g., change) information regarding multipledocuments to which the document comparison system 120 has access via thenetwork 110 (or in other examples, documents stored locally with respectto the document comparison system). The document server 102 interfaceswith the network 110 by exposing an application programming interface(API) 103. The document comparison system 120 interfaces with thenetwork 110 by exposing an API 122. The document comparison system 120includes a document comparison module 124, a document flattening module126, and a user interface (UI) module 128, all in communication witheach other. The UI module 128 includes a change accept/reject module 130and a feed module 132.

Specifically, the document comparison system 120 may access the documentserver via an API, which may comprise APIs 103 and 122, in order toretrieve various versions of documents from the document storage 108. Inother examples, the document comparison system 120 may receiveversioning and/or change information from the document server 102,indicating differences or deltas between documents stored within thedocument storage, via an API of the document server.

In examples wherein the document comparison system 120 has access to alocal document storage 108 (e.g., as part of a server or computersystem), the document comparison system 120 may access local versions ofdocuments in order to identify versions, and/or extractversioning/change information pertaining to local documents.

The document comparison system 120 may, in some further examples, atleast partially be implemented as a document comparison application thatexecutes on a client device 104 a or 104 b (e.g., a mobile or portablecomputing device).

According to various examples, systems and methods are described hereinfor computing deltas between common classes of formats, presentingdeltas in human-readable formats, and computing and storingaforementioned deltas across a collection of documents stored in cloudstorage. Also, systems and methods are described herein for presentingdocument deltas for multiple screen resolutions, reapplying or invertingdocument deltas, and making fast, fine-grained determinations of lastauthor for document sub-elements.

FIG. 2 shows a client-server system 200 that includes a cloud computingservice 202 and a number of client devices 204 a-204 d (generally,client device 204). The cloud computing service 202 provides cloudcomputing services for a set of client devices 204. In particular, thecloud computing service 202 may include one or more servers that store anumber of files accessible by the client devices 204 a-204 d, such as anexemplary collaborative spreadsheet 206. Users at the client devices 204may create, edit, copy, share, and delete files stored on the cloudcomputing service 202. For example, the client devices 204 may each usea web browser to simultaneously access the spreadsheet 206 on the cloudcomputing service 202. The cloud computing service 202 provides eachclient device 204 with a local copy of the spreadsheet 206, which userson the client devices 204 may then view and edit. The cloud computingservice 202 may synchronize the local copies of the spreadsheet 206 withone another and with a copy of the spreadsheet 206 that is stored on aserver in the cloud computing service 202. In one example, edits, whichmay be referred to herein as changes, that are made by the client device204 a are automatically sent to the cloud computing service 202 andtransmitted to the other client devices 204 b, 204 c, and 204 d. In thismanner, changes made by one collaborator may be immediately seen byother collaborators.

As used herein, a file includes a set of digitally encoded bits storedon a storage medium. A cloud file includes a file that is stored on aserver and accessible via a network. A local file includes a file storedon a user's local device. A client device includes a local device thatcommunicates with a server in a client-server relationship. As usedherein, a client device is synonymous with a user device and a localdevice, unless indicated otherwise by context. As used herein, adocument can be associated with multiple files. For example, a cloudfile may be a copy of a document stored on a server, and a local filemay be a copy of the same document stored on a local device. Generally,multiple copies of the same document may be identical, but they maydiffer if changes made by one collaborator have not yet been transmittedto other collaborators. This situation may occur when the networkconnection is slow or intermittent. Multiple copies of the same documentmay also differ slightly if the copies are stored on disparate types ofdevices, such as devices with different operating systems. In this case,different copies may have slightly different metadata, or may be encodeddifferently. For example, one copy may be encoded in a format in whichthe first bit in a byte contains the most significant bit, and anothercopy may be encoded in a format in which the first bit in a bytecontains the least significant bit. These format differences can existacross multiple files that are copies of the same document, as long asthe substance of the information that is displayed to the user is thesame across the copies. A local device may read the contents of a file(stored in nonvolatile memory) and store a model representing the filein working memory. The working memory may be volatile (e.g. RAM or anequivalent).

The client devices 204 may include any combination of desktop computers,laptop computers, tablets, smart phones, mobile electronic devices, orany other device that may connect to the cloud computing service 202through a network. Only four client devices 204 are shown in system 200,but it should be understood that any number of client devices 204 of anytype may be configured to communicate with the cloud computing service202. The cloud computing service 202 and the client devices 204 of thesystem 200 may be connected through a remote network, such as theInternet. The network connection may be facilitated through a local areanetwork, wide area network, Ethernet, fiber optic network, wirelessnetwork, cellular network, interactive television network, telephonenetwork, wireless data transmission system, two-way cable system,customized private or public computer network, interactive kiosknetwork, direct link, satellite network, and or any other wired orwireless connection.

The document comparison system may include a number of sub-modules,namely a document comparison module, a document flattening module, and auser interface module. The user interface module may in turn include achange accept/reject module, and a feed module.

Files generated by common applications hold user data. Common fileformats for documents include word processing documents, presentationsand spreadsheets. Computing deltas (or diffs) between documents isvaluable for the purposes of change tracking to let users know what haschanged in different revisions of a document, and also for the purposesof selectively undoing edits or applying edits made to documents.

The terms deltas and diffs are used interchangeably herein.

Algorithms that compute deltas between two given one-dimensional stringsequences, such as DIFF MATCH_PATCH, are known. Such algorithms operateas follows: Given an original sequence of characters “ABC,” and amodified sequence of characters “ABCD,” such algorithms will return anoutput denoting the string “ABC” as unmodified and denoting the string“D” as added. Given the initial string of characters “ABC” and amodified string of characters “AB,” such algorithms will return anoutput denoting as unmodified the string “AB” and denoting as deletedthe string “C.” Given an original string of characters ABC and amodified string of characters “ABE,” such algorithms will return anoutput denoting the string “AB” as unmodified, the string “C” asdeleted, and the string “E” as inserted. Given the original string “ABC”and the modified string “ABC,” such algorithms will return an outputdenoting the string “ABC” as unmodified. Thus, such algorithms caneasily compute deltas between one-dimensional string sequences.

However, basic string delta computation is not amenable to documents,spreadsheets, or presentations as is, because there are often complexand nested structures in documents, often stored in binary format.Documents and spreadsheets can be stored in memory as hierarchicalstructures. One type of hierarchical structure that may be used is adocument object model “DOM.”

FIG. 3 schematically illustrates a document object model (DOM) 300 usedto edit and render a document file. A document file may refer to a filecontaining a word processing document, a spreadsheet document, apresentation document, a drawing document, a database document, a HTMLdocument, an XML document, an image document, a text document, or anyother document file containing user data. In the DOM 300, objects of thedocument 305 are arranged as nodes in a hierarchy. An object may be afeature of the file. A node may have one or more nodes below it in thehierarchy, and a node may have one or more nodes above it in thehierarchy. For example, node 315 has node 320 below it and node 310above it. Similar nodes may be at the same level in the hierarchy. Forexample, nodes 330, 340, and 350 may be at the same level in thehierarchy. In one example, a model-view-controller (MVC) implementationis used to create and edit the DOM 300, and to display the contents ofthe DOM 300 to a user. In this example, the model portion of the MVCparses a file and places sections of the file corresponding to objectsof the document 305 into nodes of the DOM 300.

For example, a paragraph may be placed into node 350 of the DOM 300, anda sentence in the paragraph may be placed in node 355. One word of thesentence may be placed into node 360, and another word may be placedinto node 365. Another sentence of the paragraph may be placed into node370, with its words placed in nodes 375 and 380. For clarity ofillustration, only two sentence nodes and four word nodes are describedabove and in FIG. 3, but a paragraph may have any number of sentencesand corresponding sentence nodes, and a sentence may have any number ofwords and corresponding word nodes. In another example, a table may beplaced into the node 350 of the DOM 300, with table row elements placedin nodes 355 and 370. The contents of each cell in the table rows may beplaced in nodes 360, 365, 375, and 380, respectively. Tables may haveany number of rows and row nodes, and rows may have any number of cellnodes, but two row nodes and four cell nodes are described here forclarity of illustration. In another example, tables may be placed intothe DOM 360 with columns as the primary index. In this example, nodes355 and 370 correspond to columns of the table, and nodes 360, 365, 375,and 380 correspond to contents of each cell in the table columns. In anexample, node 310 may contain header information of the document. Node315 may contain a sentence of the header, and node 320 may contain aword of the header sentence.

For clarity of illustration, node 310 has only one subordinate node 315,which itself has only one subordinate node 320. Furthermore, asillustrated, the DOM 300 has four levels of hierarchy. However, any nodein a DOM may have any number of subordinate nodes, and a DOM may haveany number of levels of hierarchy.

After the model portion creates the DOM 300 and places contents intonodes, the view portion of a MVC may then traverse node-by-node throughthe DOM 300 and render some or all of the objects contained in the nodesof the DOM 300. The view portion may be a rendering engine. As the viewportion traverses through each node of the DOM 300, it will render thecontents of the node if it is configured to do so. The view portion mayuse hard-coded logic to decode or parse the contents of each node as itencounters the node while traversing. If the hardcoded logic isconfigured to decode or parse the contents of the node, the view portionwill render the contents of the node for display to a user. If thehard-coded logic is not configured to decode or parse the contents ofthe node, the view portion will not render the contents of the node andwill traverse to another node. In an example, the view portion maytraverse through the DOM 300 concurrently while the model portion iscreating or updating the DOM 300.

The controller portion of a MVC may interact with the view portion andthe model portion of the MVC to facilitate editing of the document 305represented by the DOM 300. When a user provides an editing input, thecontroller receives the input, determines the node of the DOM 300 towhich the input corresponds, and updates the corresponding node. Thecontroller then instructs the view portion of the MVC to render theupdated node. The update to the DOM 300 must be validated forcorrectness. This validation may occur before or after the view portionrenders the updated node. In an example, the controller may performoptimistic updating of the DOM 300. In this example, the controllerportion sends the update directly to the view portion for immediaterendering, and asynchronously updates and validates the DOM 300. If thevalidation is successful, no further action is taken with regards to theupdate. If the validation is unsuccessful, the update to the DOM 300 isreversed, and the view portion renders the DOM 300 as it existed priorto the update. Such optimistic updating provides faster displaying ofuser edits. By classifying features of the document 305 in ahierarchical structure, the view and controller portions can efficientlyinteract with the DOM 300 to display and edit the document 305.

FIG. 4 depicts a snapshot 400 of a document stored at one point in time,and another snapshot 450 of the same document stored at a later point intime. FIG. 4 also depicts a flattened snapshot 430 of the snapshot 400and a flattened snapshot 480 of the snapshot 450. The snapshot 400includes three paragraphs 406, 412 and 420. The paragraph 406 includestwo sentences 402 and 404. The paragraph 412 includes two sentences 408and 410. The paragraph 420 includes three sentences 414, 416 and 418.The snapshot 450 includes three paragraphs 456, 462, and 470. Theparagraph 456 includes two sentences 452 and 454. The paragraph 462includes an image 472 and two sentences 458 and 460. The paragraph 470includes three sentences 464, 466 and 468. An example described hereincomputes deltas between the snapshots 400 and 450, which areloaded-in-memory versions of the documents, and are stored as nestedarrays of heterogeneous elements. According to an example, deltas can becomputed by performing a process that performs “flattening” on the treestructure of a document such that it can be reduced to a string. Thedocument flattening module 126 can perform document flattening byimplementing the following steps. First, the flattening module traversesthe document recursively, and constructing nodes representing all theattributes that are significant to computing deltas. Second, theflattening module employs a serializer individually on all top levelnodes. One such serializer might be a JSON ENCODER. This processtransforms the tree into an array of strings.

FIG. 4 depicts the output of the document flattening module 126. Thedocument comparison module 126 performs a mapping of the sentences ofthe snapshot 400 to alphanumeric characters to produce the flattenedsnapshot 430. A sentence that is identical to a previously-mappedsentence will be mapped to the same alphanumeric character as thepreviously-mapped sentence. A sentence which is not identical to apreviously-mapped sentence will be mapped to a unique alphanumericcharacter. While a single alphanumeric character is described herein asthe mapping target, strings of multiple alphanumeric characters may beused instead. The flattened snapshot 430 contains three sets of uniquecharacters 432, 434, 436. The flattened snapshot 430 also containscharacters representing unique paragraphs 438, 440, and 442. To generatethe set of characters 432, the sentence 402 is represented by thecharacter “M” and the sentence 404 is represented by the character “N.”Since these are non-identical sentences, they are mapped to differentalphanumeric characters. Likewise, the set of characters 434 isgenerated by mapping the sentence 408 to the character “0” and thesentence 410 to the character “P.” Furthermore, the set 436 is generatedby mapping the sentence 414 to the character “Q,” the sentence 416 tothe character “R,” and the sentence 414 to the character “S.” The set432 is itself mapped to the unique alphanumeric character “T” 438. Theset 434 is not identical to the set 432, so the set 434 is mapped to aunique alphanumeric character “U” 440. The set 436 is not identical toeither the set 432 or the set 434, so the set 436 is mapped to anotherunique alphanumeric character “V” 442.

The document flattening module 126 generates the flattened snapshot 480from the snapshot 450 in a similar manner. The document flatteningmodule 126 maps the sentence 452 to the character “M” and the sentence454 to the character “N” to produce the set 482. The document flatteningmodule 126 maps the image 472 to the character “I,” the sentence 458 tothe character “0,” and the sentence 460 to the character “P” to generatethe set 484. The document flattening module 126 maps the sentence 464 tothe character “Q,” the sentence 466 to the character “X” and thesentence 468 to the character “S” to generate the set 486. Since thesentence 452 is identical to the sentence 402, both sentences receivethe same character “M.” Likewise, sentences 458, 460, 464, and 468 areidentical to sentences in the previous snapshot 400, and each of thesentences is not assigned a unique character, but rather is assigned thesame alphanumeric character as its matching sentence. Since the image 472 and the sentence 466 do not appear in the snapshot 400, they areassigned new, unique alphanumeric characters. The document flatteningmodule 126 further flattens the sets 482, 484, and 486 into uniquealphanumeric characters. Since the set 482 is identical to the set 432,the set 482 is assigned to the same alphanumeric character, “T” 488.Since the set 484 is different from the set 434 and allpreviously-mapped sets, the set 484 is assigned a new, uniquealphanumeric character, “W” 490. Likewise, since the set 486 isdifferent from the set 436 and all other sets, the set 486 is mapped tothe new, unique alphanumeric character “Y” 492.

After the document flattening module 126 has produced flattenedsnapshots from document snapshots, the document comparison module 124can then compute a delta between the two snapshots by applyingone-dimensional document delta algorithms.

Thus, the flattening module is capable of reducing this problem to beone of comparing complex nested structures to a simple comparison of thestrings “TUV” to “TWY”, by making it amenable to applying thestandardized longest common subsequence algorithm (e.g.,DIFF_MATCH_PATCH). Once the delta has been computed over the simpleflattened strings, what the delta means is reconstructed in documentspace by inverting the mapping. This approach is also amenable toalternative tree structured document formats or DOM hierarchies,including but not limited to spreadsheets, presentations, PDF files andCAD files.

Application-generated files can have higher-order dimensionality. Forexample, a spreadsheet has an additional order of dimensionality ascompared to a word processing document. Data in these higher-dimensionaldocuments is often manipulated in ways specific to the higherdimensionality. For example, in a spreadsheet, a user can performoperations such as adding rows, moving rows, deleting rows, copyingrows, adding columns, moving columns, deleting columns, and copyingcolumns. A naive approach which forms this data into a series of rowscan fail because many operations affect both many columns and many rows.

According to an example, a document comparison system 120 may comparetwo spreadsheet snapshots S1 and S2 as follows. First, the documentflattening module 126 traverses the spreadsheet S1, one row at a time.Next, the document flattening module 126 maps each row in the snapshotto an alphanumeric character (and maps to a new, unique alphanumericcharacter if the row is not identical to a previously-mapped row). Next,the document flattening module 126 adds each mapped alphanumericcharacter to a set S1_HORIZONTAL.

Then, the document comparison module traverses the snapshot S2, one rowat a time. The document flattening module 126 maps each row in thesnapshot S2 to an alphanumeric character (and maps to a new, uniquealphanumeric character if the row is not identical to apreviously-mapped row). Next, the document flattening module 126 addseach alphanumeric character encountered to a set S2_HORIZONTAL. Then,the document comparison module 124 computes the cardinality of theintersection of sets S1_HORIZONTAL and S2_HORIZONTAL. Computing thecardinality of the intersection of sets includes computing the number ofshared elements, as will be described in further detail below.

To proceed column-wise, the document flattening module 126 traverses thespreadsheet snapshot S1, one column at a time. Next, the documentflattening module 126 maps each column in the snapshot S1 to analphanumeric character (and map to a new, unique alphanumeric characterif the row is not identical to a previously-mapped row). Next, thedocument flattening module 126 adds each alphanumeric characterencountered to a set S1_VERTICAL. Then, the document flattening module126 traverses the spreadsheet snapshot S2, one column at a time. Next,the document flattening module 126 maps each column in an input sheet toan alphanumeric character (and map to a new, unique alphanumericcharacter if the row is not identical to a previously-mapped row). Next,the document flattening module 126 adds each alphanumeric characterencountered to a set S2_VERTICAL. Finally, the document comparisonmodule 124 computes the cardinality of the intersection of setsS1_HORIZONTAL and S2_HORIZONTAL.

FIG. 5 depicts two snapshots 500 and 550 of a spreadsheet document. Thesnapshot 500 contains the cells 502, 504, 506, 508, 510, and 512. Thesnapshot 550 contains the cells 552, 554, and 556. The snapshot 550 isidentical to the snapshot 500, except that a row has been deleted.

FIG. 6 depicts the operation of the document flattening module 126 whenoperating on the snapshots 500 and 550. FIG. 6 depicts flattenedsnapshots 600 and 610. The flattened snapshot 600 is a row-wiseflattening of the snapshots 500 and 550. The flattened snapshot 600contains two sets of characters, 602 and 604. The sets 602 and 604contain unique rows. The first row of the snapshot 500 is represented bythe set 602, and the second row of the snapshot 500 is represented bythe set 604. Since the first row of the snapshot 550 is identical to thefirst row of the snapshot 500, the first row of the snapshot 550 ismapped to the set 602. The set 602 is itself mapped to the alphanumericcharacter “M” 606. The set 604 is mapped to the unique alphanumericcharacter “N” 608. Thus, the snapshot 500 can be represented as “MN,”while the snapshot 550 can be represented by the alphanumeric character“M.”

The flattened snapshot 610 represents a column-wise flattening of thesnapshots 500 and 550. Columns A, B, and C of the snapshot 500 aremapped to the sets 612, 614, and 616, respectively. Columns A, B, and Cof the snapshot 550 are mapped to the sets 618, 620, and 622,respectively. The sets 612, 614, 616, 618, 620, and 622 are mapped tothe unique alphanumeric characters 624, 626, 628, 630, 632, and 634,respectively. Since none of the columns of snapshots 500 and 550 areidentical to one another, the sets are each mapped to uniquealphanumeric characters. Even though, for example, column A of snapshot500 and column A of snapshot 550 share a cell in common, the columnsdiffer by the deletion of the second row. Thus, the columns are notidentical.

Next, the document comparison module 124 computes the cardinality of theintersection of sets in the flattened snapshots 600 and 610. FIG. 7depicts row-wise sets and column-wise sets of the flattened snapshots600 and 610, and their respective cardinalities. FIG. 7 includes arow-wise mapping 700 and a column-wise mapping 750. The row-wise mapping700 includes a set S1_HORIZONTAL 702 representing the snapshot 500 and aset S2_HORIZONTAL 704 representing the snapshot 550. The set 702contains the characters “M” and “N,” each of which represents a row inthe snapshot 500. The set 704 contains a single character “M,” whichrepresents the single row in the snapshot 550. The row-wise mapping 700also contains the computed cardinality 706. The cardinality 706 of theintersection of sets 702 and 704 is one the symbol “A” represents theintersection operator. The cardinality 706 is 1 because the sets 702 and704 share one element, namely “M.”

The column-wise mapping 750 contains the column-wise sets 752 and 754.The column-wise set 752 represents the columns of the snapshot 500, asmapped to alphanumeric characters according to the mapping 610. Thecolumn-wise set 754 represents the columns of the snapshot 550, asrepresented by the column-wise mapping 610. The column-wise mapping 750also contains the computed cardinality 756 of the sets 752 and 754.Since no elements are shared between the sets 752 and 754, thecardinality of 756 is zero. The cardinality of an intersection of setsrepresents the degree of overlap between the sets, or, alternatively,the number of shared elements between the sets. When determining whetherto compare two snapshots on a row-wise or a column-wise basis, thedocument comparison module 124 will choose to compare using the basiswith the highest cardinality. In the example depicted in FIG. 7, therow-wise basis 700 has the higher cardinality 706. Thus, when comparingthe snapshots 500 and 550, the document comparison module 124 willcompare these snapshots on a row-wise basis. Accordingly, the documentcomparison module 124 can compare using the most efficient basis.

FIG. 8 depicts two spreadsheet snapshots 800 and 850. The snapshot 800represents a spreadsheet with six cells, indexed by rows and columns.The first row of the snapshot 800 contains the cells 802, 804, and 806.The second row of the snapshot 800 contains the cells 808, 810, and 812.The snapshot 850 contains four cells, indexed by row and column. Thefirst row of the snapshot 850 contains the cells 852 and 854. The secondrow of the snapshot 850 contains the cells 856 and 858.

FIG. 9 depicts a row-wise mapping 900 and a column-wise mapping 920 ofthe snapshots 800 and 850. The first and second rows of the snapshot 800are represented by the sets 902 and 904, respectively. The first andsecond rows of the snapshot 850 are represented by the sets 908 and 910,respectively. The sets 902, 904, 908, and 910 are mapped to thealphanumeric characters 912, 914, 916, and 918, respectively, usingsystems and methods described with respect to FIG. 6. The mapping 920represents a mapping of the columns of the snapshots 800 and 850 tounique alphanumeric characters. The first, second, and third columns ofthe snapshot 800 are represented by the sets 922, 924, and 926,respectively. Since the first column, “Column A” of the snapshot 850 isidentical to the first column of the snapshot 800, the first column ofsnapshot 850 is also represented by the set 922. Likewise, since thesecond column of the snapshot 850 is identical to the second column ofthe snapshot 800, the second column of the snapshot 850 is alsorepresented by the set 924. The sets 922, 924, and 926 are mapped to theunique alphanumeric characters 928, 930, and 932, respectively, usingsystems and methods already described with respect to FIG. 6.

Next, the document comparison module 124 computes the cardinality of theintersection of sets in the flattened snapshots 900 and 910. FIG. 10depicts row-wise sets and column-wise sets of the flattened snapshots900 and 910, and their respective cardinalities. FIG. 10 includes arow-wise mapping 1000 and a column-wise mapping 1050. The row-wisemapping 1000 includes a set S1_HORIZONTAL 1002 representing the snapshot800 and a set S2_HORIZONTAL 1004 representing the snapshot 850. The set1002 contains the characters “M” and “N,” each of which represents a rowin the snapshot 800. The set 1004 contains the characters “0” and “P,”each of which represent a row in the snapshot 850. The row-wise mapping1000 also contains the computed cardinality 1006. The cardinality 1006of the intersection of sets 1002 and 1004 is one the symbol ^(“A”)represents the intersection operator. Since no elements are sharedbetween the sets 1002 and 1004, the cardinality of 1006 is zero.

The column-wise mapping 1050 contains the column-wise sets 1052 and1054. The column-wise set 1052 represents the columns of the snapshot800, as mapped to alphanumeric characters according to the mapping 910.The column-wise set 1054 represents the columns of the snapshot 850, asrepresented by the column-wise mapping 910. The column-wise mapping 1050also contains the computed cardinality 1056 of the sets 1052 and 1054.The cardinality 1056 is 2 because the sets 1052 and 1054 share twoelements, namely “R” and “S.” The cardinality of an intersection of setsrepresents the degree of overlap between the sets, or, alternatively,the number of shared elements between the sets. When determining whetherto compare two snapshots on a row-wise or a column-wise basis, thedocument comparison module 124 will choose to compare using the basiswith the highest cardinality. In the example depicted in FIG. 10, thecolumn-wise basis 1000 has the higher cardinality 1056. Thus, whencomparing the snapshots 800 and 850, the document comparison module 124will compare these snapshots on a column-wise basis. Accordingly, thedocument comparison module 124 can compare using the most efficientbasis.

The approach employed by the comparison module, as outlined above, alsofilters out for common classes of minor edits (e.g., sorting aspreadsheet or copying rows), although in some cases where ordering isimportant, such as a spreadsheet containing priorities of items, insteadof a set, one can maintain a dictionary that maps an alphanumericcharacter corresponding to a row to a list of positions for a row.

In summary, the comparison module may perform a two pass horizontaltraversal and vertical traversal of the spreadsheet to identify changedelements, and then discard the larger of the two results. Since thetraversal happens to look at content while scanning, we refer to them ascontent-addressed scans. Also, to ensure that the comparison module canaccommodate a large number of rows efficiently, multi-byte characterencodings such as Unicode may be used. Often spreadsheets have multiplesheets, and a user can add or insert sheets. One can just reduce aspreadsheet to a string and map them to a character sequence, so one canrun the standard algorithms.

FIG. 11 depicts a flowchart of a method 1100 to compute deltas betweenword processing documents and a method 1150 to compute deltas betweenspreadsheet documents. In the method 1100, at the flattening step 1102,the document flattening module 126 flattens documents into documentsnapshots. At the delta computation step 1104, the document comparisonmodule 124 computes deltas between the two flattened snapshots. Thedelta can be represented by the one-dimensional characters which are notshared between the snapshots. At the reconstruction step 1106, thedocument comparison system 120 reconstructs the modified portions of thesnapshots by inverting the mapping used in the flattening step 1102.These reconstructed portions are human-readable and can be presented toa user by an appropriate user interface.

The method 1150 for computing deltas between spreadsheets proceeds asfollows. Input spreadsheets 1152 and 1154 are processed by the documentflattening module 126. The document flattening module performs both arow-wise content addressed scan 1156 and a column-wise content addressedscan 1158. At step 1160, the document comparison module 124 selects thescan basis with the smaller delta. One way that the document comparisonmodule 124 does this is by selecting the intersection of sets with thehigher cardinality, as described with respect to FIGS. 7 and 10. Thedocument comparison module 124 then produces an output 1162 whichcontains the smaller delta. In this way, the document comparison modulecomputes the deltas between snapshots in the most efficient manner.

Sometimes deltas for a complete document or spreadsheet can be large,and since their primary usage is to ensure that a user can see what haschanged without having to look at the entire file, the diff algorithmmay, in some examples, be augmented with some enhancements related toimproved presentation.

In some examples, the document comparison module 124 performs chunkranking and filtering for document deltas. Chunk ranking and filteringcan be useful to limit the display to the components of a document whichhave changed significantly. A chunk is a subset of a document, such as apage, paragraph, sentence, word, column, or row. In some examples, thedocument comparison module 124 (which implements a document deltaalgorithm) reviews all of the deltas in a document, and ranks the deltasbased on the number of changed characters in each delta. Then, thedocument comparison module 124 selects the N chunks with the largestdeltas. The document comparison system 120 then displays a summarycontaining the N chunk and the corresponding deltas to a user. The UImodule 128 may perform this displaying. The number “N” may be selectedon the basis of screen size or resolution.

FIG. 12 depicts a user interface displaying a summary of the two chunksof a document with the largest deltas. In this example, N=2. FIG. 12depicts a chunk 1210 corresponding to a sentence and a chunk 1220corresponding to a paragraph. In the chunk 1210, a text insertion 1212has been made. The text insertion 1212 comprises an insertion of threecharacters. In the chunk 1220, which comprises three sentences, adeletion 1222 and two insertions 1224 and 1226 have been made. Chunks ofthe document which did not contain deltas are omitted from the userinterface shown in FIG. 12. In this way, the user can quickly determinewhich chunks of the document have been changed. In some examples, to aidthe user in quickly recognizing which portions of the document have beenedited, the UI module 1228 highlights portions of text which have beenchanged. In these examples, the portions of the text can be highlightedby altering the color of the background surrounding the text, alteringthe font color of the text, underlining the text, striking through thetext, or other modifications to the font, such as type of font, fontsize, or font emphasis such as italics. In the example depicted in FIG.12, unmodified text is rendered in a black font color with a whitebackground, inserted text is rendered in a dark green font with a lightgreen background, and deleted text is rendered in a dark red font with alight red background and is stricken through. In other examples, alltext may be rendered in a single color with a background of anothersingle color, inserted text may be underlined, and deleted text may bestricken through or enclosed with brackets. In this way, the user canquickly determine which portions of the displayed chunks have beenedited.

In some examples, the document comparison module 124 strips and augmentsthe display data to facilitate presentation. In some examples, thedocument comparison module 124 performs stripping and augmentation whencomputing deltas between two spreadsheet snapshots. In an illustrativeexample, the document comparison module 124 computes deltas between twospreadsheet snapshots and determines that only two rows contain changes.These two rows, for example, rows 17 and 18, may be separated from aheader row by a number of rows. If the intervening rows were also shownin a user interface, then the user may have difficulty in determiningthe context of the changes. Thus, for ease of user interpretation, it isvaluable to show a header row of the spreadsheet, not show unchangedrows, and show an indicator that makes clear to the user that there is agap in the rows. The gap in the rows corresponds to the unchanged rows.As such, the document comparison module (and, in one example embodiment,a spreadsheet sub-module) implements an algorithm that also copies thetop row of a spreadsheet based on a determination to generate ahorizontal delta, and the first column based on a determination togenerate a vertical delta, and strips any intermediate unchanged rows.

FIG. 13A and 13B depict examples in which rows and columns have beenstripped after performing row and column-wise diffs. FIG. 13A includes auser interface 1300 that depicts deltas as determined by a row-wisediff. In the user interface 1300, a page tear 1304 illustrates to a userthat intervening rows which were unchanged have been eliminated from thedisplayed portion of the spreadsheet. The user interface 1300 includes aheader row 1302 to provide context for the changed portions of thespreadsheet. The user interface 1300 also includes rows 1306, 1308,1310, 1312, and 1314 which contain edited portions 1316, 1318, 1320, and1322. The edited portions 1316, 1318, 1320, and 1322 are depicted withhighlighting, background coloring, strikethrough text, and other fontmodification to illustrate to the user that these portions have beenchanged.

FIG. 13B depicts a user interface 1350 that illustrates the results of acolumn-wise diff computation performed by the document comparison module124. The user interface 1350 includes a header column 1352, a page tear1354, and edited column 1356. The edited column 1356 includes changedcells 1358, 1360, 1362, and 1364. The page tear 1354 represents columnsB through J which contain unchanged data and are omitted from display inthe user interface 1350. The header column 1352 contains headerinformation that provides context to the changed portions 1358, 1360,1362 and 1364. By including a header column 1352, the user interface1350 provides a concise and meaningful representation of the changes toa user.

In some examples, the document comparison system 120 operates on a largecollection of documents in cloud storage. In these examples, thedocument comparison system 120 may compute incremental deltas. In afurther example, the document comparison 124 module may generate anactivity feed for all files to which a particular user has access. It isadvantageous (but nonetheless a technical challenge) to ensure thataccess to deltas is fast, and efficient in terms of both space and time.Given that fetching and downloading raw data to compute deltas isexpensive, according to some examples there is provided a caching layerthat incrementally computes deltas to ensure that, when an application(e.g., a website, an online word processor, or mobile app) asks for adelta to show a user what has changed, the application gets a responsewith minimal delay. Caching layers such as REDIS and MEMCACHE typicallytake time in the low milliseconds to respond and store objects, andcomputing deltas, particularly for large files, can take seconds.

FIG. 14 depicts a system for computing and caching deltas for documentsstored in cloud storage. FIG. 14 depicts a compute cluster 1404, acaching layer 1408, and a cloud storage database 1414. The computecluster 1404 interfaces with applications and performs deltacomputation, as well as interfacing with the caching layer 1408, and thecloud storage database 1414. The computer cluster may be a server orserver processor, a personal computer, or any computing deviceconfigured to perform the functions of the compute cluster 1404. Thecompute cluster 1404 may be a cluster of servers or server blades. Thecaching layer 1408 stores incrementally computed deltas for fast accessby the compute cluster 1404 and may comprise REDIS or MEMCACHE. Thecloud storage database 1414 stores the documents for which deltas arecomputed and snapshots, which are used to compute deltas.

At step 1412, a new file listing is received. The compute cluster thenperforms step 1416 and fetches the data for the files. The computecluster computes deltas between the snapshots of the files and, at step1410 stores the computed deltas in the caching layer 1408. At step 1402,an application requests document deltas. The requesting application maybe a cloud service application or other network-based application forwhich a fast response is desired. The compute cluster 1404 interfaceswith the caching layer 1408 to read the latest computed delta fromcache, and then, at step 1418 sends a response to the application. Thecompute cluster 1404 can interface with the caching layer 1408 fasterthan the compute cluster 1404 could perform an on-demand document deltacomputation. Accordingly, the speed of the response is increased, andthe delay between the response 1418 and the request 1402 is reduced.

At step 1406, a background process walks through all deltas cached inthe caching layer 1408 and discards any deltas that are older than aconfigurable time threshold. In this way, the size of the caching layeris kept to a minimum while retaining the most recent deltas.

In this section, we describe a method, according to some examplesimplemented by a document comparison module, to cache deltas and toprovide up-to-date deltas. Typically cloud services expose a sequence ofevents with a key representing a monotonically increasing counter forthe last event. Assume, for example, a user's events indicate that theyhave a certain number of events, with the last event having a sequencenumber of 100.

The methodology implemented by the document comparison module tracks thelast sequence number for which the deltas of a user are up to date, andstores 100 in a database for the user's account. Whenever a requestcomes in to generate a news feed of document updates for a user, thedocument comparison module looks at the events, and only re-computesdeltas for events with a sequence number >100. To surface all activityfor one given file, it may be useful to compute multiple deltas for thesame file. To support multiple deltas, a cache keying scheme uses a3-tuple: a unique identifier for the file, an identifier for the oldversion, and an identifier for the new version.

FIG. 15 depicts a feed 1500 which contains a summary of changes to adocument along with user comments about the document and changes. Thefeed 1500 includes comments 1502, 1508, and 1510. The feed 1500 alsoincludes changes 1504, 1506, and 1512. The change 1512 is depicted withcontext of the surrounding text to aid user interpretation of thechange. The comments 1502, 1508, and 1510 allow users to communicateregarding the document and the changes. Including these comments in thefeed 1500 provides further context for the changes 1504, 1506, and 1512.

While the description below relates to spreadsheets, it will beappreciated that the method is applicable to other document or contenttypes.

In some examples, the document comparison system 120 presents summariesin a format that closely resembles the original document. In the exampledepicted in FIG. 13, the summary closely resembles its original documenttype: a spreadsheet. FIG. 13 depicts the highlighting of additions ingreen and deletions in red with a strikethrough. This makes it easy fora user to quickly scan and recognize the changed portions. Furthermore,the systems and methods described herein can display changes acrossmultiple sheets of a spreadsheet documents or pages of a word processingdocument. A spreadsheet workbook file may contain dozens sheets, and aword processing document can contain many pages. In some examples, thesystems and methods described herein will detect and display the deltasfor only those sheets or pages which contain pages.

The document comparison system 120 can increase the value of presentedinformation by providing contextually relevant portions of a document.FIG. 16 depicts two possible user interfaces 1600 and 1603. In the userinterface 1600, only the changed portion 1602 is displayed. A userviewing the user interface 1600 can see that the text “6” was inserted,but the user may not realize the importance of the insertion. The userinterface 1603 includes a similar changed cell 1608 but also includescontext, in the form of a header row 1604 and a page tear 1606 depictingomitted intervening rows. The insertion of “6” into a cell ismeaningless without proper context. As shown in the user interface 1603,the header row 1604 conveys to the user that this “6” refers to Chris'rating.

While this context is useful, it is also useful to display the headercolumn and additional surrounding cells to enable a viewer to fullyunderstand the full meaning of a change. FIG. 17 depicts a userinterface 1700 that shows an increased level of context for faster userinterpretation. The user interface 1700 includes the insertion of thetext “6” 1708, a header row 1704, and a page tear 1706 showingintervening rows that are omitted, and also shows surrounding cells. Asshown in FIG. 17, the inserted “6” 1708 is Chris' rating for aparticular bottle and vintage of wine. With the full context that thisexample method provides, the user can now understand the meaning of thisinserted “6” 1708. Specifically, the user can understand that “6” 1708is Chris's rating for a bottle of Penfolds Shiraz of vintage 2012.

The method, according to some examples, parses and understands thelayout of the document, and the location of the change(s). The methodthen provides a determined amount of contextually relevant informationto make sense of the change. The method balances the need for contextand meaning with keeping the document delta succinct. The methoddetermines which columns or rows are essential to provide acontext-relevant perspective with respect to a specific change. In someexamples, such as the user interface 1300 of FIG. 13, the methoddisplays a header row to provide context. In some examples, such as inthe user interface 1350, the document comparison system 120 onlydisplays a header column, rather than a header row.

On mobile devices, news feeds, email, and in other mediums, brevity ofinformation may be desirable in view of limited screen space, buttechnically challenging to achieve. Simply displaying a full spreadsheetwith hundreds of rows or columns would be unusable. The documentcomparison system 120, according to some examples, accounts for this andoptimizes the display for brevity in several example ways.

In the user interface 1700 depicted in FIG. 17, the modifications weremade only to the 11th row. Rather than displaying rows 2 through 10, thedocument comparison system 120, according to example, only displays theheader row necessary for context and the rows which contain new changes.The rows that are omitted are represented as a page tear to inform theuser that the document comparison system 120 omitted from displayirrelevant, unchanged rows. The document comparison system 120 mayprovide page tears horizontally or vertically, depending on where thecrucial context is located.

When very large portions of a spreadsheet are modified, the display ofthe change can still be large. In some use cases, particularly in feeds,it is desirable to limit the height of any one change, while stillallowing the user the option to see the full change. The documentcomparison system 120 and the UI module 128 provide this ability bycollapsing the change if it exceeds a specific height threshold.

As shown in FIG. 18, the user may make a selection to view the fullchange. FIG. 18 depicts a user interface 1800 that shows a subset of achange. The user interface 1800 includes a clickable portion 1802, theuser selection of which triggers the UI module 128 to expand the changein a smooth animation.

For particularly lengthy text, the method may limit the contents of achange. If the change exceeds a threshold, the method cuts off the textand inserts an ellipsis. This can be particularly valuable for mobile orother use cases with very limited screen real estate. As shown in FIG.18, the change 1804 includes an ellipsis at the end of the displayedportion of the text, which indicates that the full change is notdisplayed.

The output of this method can be any markup language (e.g. HTML), whichcan be used and rendered on practically any device or application. FIG.19 depicts a user interface 1900 as output by the user interface module128 and rendered for display on a mobile device.

FIG. 20 depicts a user interface 2000 showing changes to a spreadsheetdocument and a field for user comments as rendered by the user interfacemodule 128 and displayed on a mobile device.

To give users control of which edits they would like to keep and whichedits to discard, the document comparison module 124 may provide a userselective control of which deltas to accept, and which to reject. FIG.21 depicts a user interface 2100 that is configured to allow a user tocontrol whether to accept or reject changes or deltas. The userinterface 2100 includes a document display 2110 and a track changesdisplay 2150. The document display 2110 includes two changes 2112 and2114. The track changes display 2150 includes a summary of the changes2152 and clickable areas 2154 and 2156. The clickable area 2154 is an“Accept” button, and user selection of the clickable area 2154 triggersthe document comparison system 120 to accept the change and to merge thechange into the document. User selection of the clickable area 2156triggers the document comparison system 120 to reject the change and todelete the corresponding delta from the delta repository 140.

Cloud services expose APIs to get a list of all the elements of adocument, and also APIs to alter them.

FIG. 22 depicts an example in which the document comparison module 124(as part of a content management system) inverts deltas. FIG. 22includes a set of snapshots 2200. The set of snapshots 2200 includes anactive document 2210 and a base snapshot 2220. The base snapshot isgenerated when the document flattening module 126 walks through the treestructure of a document, flattens or serializes it, and stores theserialized or flattened snapshot. This stored snapshot will henceforthbe referred to as “the base snapshot” 2220. The active document snapshot2210 is generated by the document flattening module 126 when thedocument flattening module 126 walks through the tree structure of thedocument at a later point in time, serializes or flattens the document,and stores the serialized or flattened document. This snapshot 2210 is aflattened snapshot of the real-time document. The document comparisonmodule 124 periodically computes deltas between the active documentsnapshot 2210 and the base snapshot 2220 using a diff algorithm 2230.The document comparison system 120 periodically shows these computeddeltas to a user. The document comparison module 124 uses the systemsand methods described herein to periodically compute these deltas. Thebase snapshot 2220 contains three paragraphs: A 2222, B 2224, and C2226. After the document flattening module 126 has flattened thedocument into the base snapshot 2220, a user of the document comparisonsystem 120 has deleted paragraph B 2224. Thus, the active documentsnapshot 2210 only contains the paragraphs A 2212 and C 2214. Thedocument comparison system 120 continually compares the base snapshot2220 to the current or active document snapshot 2210 and generatesdeltas that a user can accept or reject.

FIG. 22 also depicts an application-level output 2250 of the documentcomparison system 120. The output 2250 is a user interface that includesa document display 2260 and a track changes display 2265. The documentdisplay 2260 depicts the active document and includes a rendering ofparagraph A 2262 and paragraph C 2264. The track changes display 2265includes a clickable portion 2272 which, when clicked, triggers thedocument comparison system 120 to begin tracking changes, flattening thedocument into flattened snapshots, and computing deltas. The trackchanges display 2265 also includes a clickable area 2274, which, whenselected by the user, triggers the UI module 128 to highlight newchanges. The track changes display 2365 includes a summary of changes2276, which provides a brief synopsis of the numbers of changes and abreakdown by type of change. The track changes display 2265 alsoincludes a change menu 2278 which receives user input to accept orreject a specific change. The change menu 2278 includes a summary of thechange 2266, and two clickable areas, 2268 and 2270. Operation of thechange menu 2278 is further explained with respect to FIG. 23.

FIG. 23 depicts a change menu 2300 and a change menu 2350. The changemenu 2300 provides a user interface for receiving an input from a userto invert a change, or in other words, to undo a change. The userinterface 2300 includes a summary of the change 2302, an indicator ofthe user who generated the change, and a clickable area 2304. Userselection of the clickable area 2304 triggers the document comparisonsystem 120 to reject the change. Accordingly, the clickable area 2304 isa reject button. The document comparison system 120 rejects a changeusing the following algorithm. First, the document comparison system 120recreates a previous version of the element from the base snapshots,inserts the recreated element into the current document at theappropriate offset, and deletes the current element.

The change menu 2350 includes a summary of the change 2352, anindication of the user who generated the change, and clickable areas2354 and 2356. The clickable area 2354 is an accept button, and whenselected by the user, the document comparison system is triggered toaccept the change. The clickable area 2356 is a reject button and whenclicked, the document comparison system 120 is triggered to reject thechange as described with respect to the menu 2300. When a user selectsthe clickable area 2354 to accept a change, the document comparisonsystem 120 accepts the selected delta 2352 using the followingalgorithm. First, the document comparison system 120 locates the elementcontaining the delta 2352 in the most recent snapshot of the document.Then, the document comparison system 120 replaces the correspondingelement in the base snapshot with the located element accepted by theuser. These elements may be deltas or chunks. In this way, the documentcomparison system 120 can receive inputs from users to accept or rejectspecific changes in the document.

For the purposes of allowing multiple users to collaborate on a documentand also accurately capture who made which edit, one can store metadataon a per character level about who made a change and at what time byencoding it in the colors of the document. To translate the state of adocument into who made what edit, one can traverse a document and invertthe mapping from color to user/time of edit. This data when surfaced inan application such as a word processor can make it easy for users tocollaborate on a document. Colors in most computer systems arerepresented as 3 channels consisting of 8 bits each, red, green andblue. Since there are a limited number of color bits, and for visualconsistency it is important that the edits from the same user retain thesame color. Also given most documents have white backgrounds, it'simportant to have colors which are light.

FIG. 24 depicts a mapping of bits used to store metadata including thetime and author of a change. FIG. 24 depicts an example in which red,green, and blue channels are used to represent colors of text in adocument. FIG. 24 includes a red channel 2402, a green channel 2404, anda blue channel 2406. Each of the channels 2402, 2404, and 2406 are 8-bitchannels, meaning that the proportion of color represented by a channelcan be represented on a scale from 0 to 255, or 2⁸. The UI module 128assigns values to each of the bits in the channels 2402, 2404, and 2406in the following way. First, the most significant bit in each channel2408 is set to 1. This limits the emitted colors to be light, white,background-friendly colors. Second, the user interface module 128represents a user's user ID identifier by mapping it to a 9-bit number.The UI module 128 stores the 9-bit number as bits U-0 through U-8,represented by the block of bits 2410. Third, the UI module 128represents the time of the edit by mapping the time to a 12-bit numberrepresenting hour of year. The user interface module 128 stores themapped 12-bit number in bits T-0 through T-11, represented by the blockof bits 2412. This mapping results in a precision of three hours, but inpractice given cloud service APIs, the document comparison system 120can compute an intersection of the last time a revision was made by agiven user within a three hour window and obtained fine-grained resultsfor the time of edit. In this way, the color in which a change isdisplayed can provide information regarding the user and the time of theedit. Encoding this information into the color can allow users todetermine author and time of edit, and also provides a means of encodingthis information within the edit in a compact fashion.

FIG. 25 depicts a flowchart of a method 2500 used by the documentcomparison system 120 to compute deltas and generate a feed for displayto a user. At step 2502, the document comparison system 120 computes andstores a first snapshot of a collaborative document hosted on a server.At step 2504, the document comparison system 120 receives a first editto the collaborative document from a first user. At step 2506, thedocument comparison system 120 modifies the active version of thecollaborative document based on the first edit. At step 2508, thedocument comparison system 120 stores a second snapshot of the modifiedcollaborative document, which reflects the results of the first edit. Atstep 2510, the document comparison system flattens the first and secondsnapshots into flattened snapshots. This flattening can occurimmediately after step 2508, or the document comparison system 120 canflatten the first snapshot into a first flattened snapshot at any timeafter step 2502. At step 2512, the document comparison system 120determines all subsets of the first and second flattened snapshots.These determined subsets may or may not be the most compactrepresentation of the changes, and the method 2500 continues todetermine the most compact representation. At step 2514, the documentcomparison system 120 processes each subset of the second flattenedsnapshot as follows. At the decision block 2516, the document comparisonmodule 124 determines if the subset in question is different from thecorresponding subset of the first flattened snapshot. If thecorresponding subset of the first flattened snapshot is not differentfrom the subset in question of the second flattened snapshot, the methodproceeds to step 2518, where the subset in question of the secondflattened snapshot is discarded.

If, at decision block 2516, the document comparison system 120determines that the subset in question of the second flattened snapshotis different from the corresponding subset of the first flattenedsnapshot, the method proceeds to decision block 2520. At decision block2520, the document comparison module 124 determines if the subset inquestion of the second flattened snapshot is smaller than any othersubset which is determined to be different. If the subset in question isnot smaller, then the method proceeds to step 2522, where the subset isdiscarded.

If, at step 2520, the document comparison module 124 determines that thesubset in question is smaller than any other different subset, themethod proceeds to step 2524. At step 2524, the document comparisonmodule 124 stores the subset in question as a delta between the firstand second snapshots. At step 2526, the feed module 132 generates a feedwhich includes the delta. At step 2528, the UI module 128 sends thegenerated feed to a client device for display to a user. The generatedfeed may be included in any of the user interfaces as depicted in FIGS.12, 13, and 15-23.

FIG. 26 is a block diagram illustrating the architecture of mobiledevice software 2600, which may be installed on any one or more of themobile devices used to perform part, or all of the example methodsdiscussed above.

The mobile device software 2600 is composed of a software stack ofdifferent layers, namely operating system layer 2602, runtimes 2604,libraries 2606, application frameworks/APIs 2608 and applications 2610.The operating system layer 2602 includes one or more kernels 2612,drivers 2614 and other services 2616.

The kernel 2612 acts as an abstraction layer between the hardware of amobile device, and the other software layers. For example, the kernel2612 may be responsible for memory management, process management,networking, security settings, etc. The drivers 2614 are responsible forcontrolling communication with the underlying hardware (e.g., forfacilitating communication with Bluetooth hardware that may be used forNFC tag identification). The drivers 2614 may include a display driver,camera driver, Bluetooth driver, flash memory driver, a USB driver, akeypad driver, a Wi-Fi driver, audio drivers and a power managementdriver.

The runtimes 2604 may include virtual machines 2618 (e.g., the DalvikVirtual Machine or a Java Virtual Machine). Other example runtimes mayinclude Objective-C runtime 2600, which includes both the Objective-Cdynamically-linked runtime libraries and the underlying C libraries.

The libraries 2606 enable a mobile device to handle different types ofdata. The libraries 2606 may be written in C/C++ and are accessed viaJava interfaces. The libraries 2606 include a surface manager forcompositing windows, 2D and 3D graphics, media codex (e.g., MPEG4,H2664, MP3 etc.) and SQL database (e.g., SQL light) and a native webbrowser engine (e.g., WebKit). Example libraries include a surfacemanager library that enables direct drawing on the screen, a mediaframework that provides media codecs allowing for the recording orplayback of different media formats (e.g., MPEG4, H2664, MP3 etc.), anOpenGL framework that is used to render 2D and 3D in a graphic contenton the screen, and a WebKit that is a browser engine used to displayHTMR content.

The application frameworks 2608 may include an activity manager thatmanages the activity lifestyle of applications, a contents provider thatmanages data sharing between applications, a view system that handlesGUI-related tasks, a telephony manager that manages voice calls, alocation manager that providers location-based services (e.g., using GPSor NFC information and supporting fine-gained location providers as GPSand coarse-gained location providers such as cell phone triangulation),and a resource manager that manages various types of resources used bythe applications 2610.

The applications 2610 include a home application 2650, a contactsapplication 2652, a browser application 2654, a book reader application2656, education applications 2658-2660, gaming applications 2662-2664,and document processing module 2666. The document processing module 2666may incorporate a document comparison module to perform themethodologies described above.

Operationally, the applications 2610 may perform API calls 2670 throughthe software stack of the mobile device software 2600 and receivemessages 2672 in response to such API calls.

FIG. 27 is a block diagram of a machine in the example form of acomputer system 2700 within which instructions, for causing the machineto perform any one or more of the methodologies discussed herein, may beexecuted.

In alternative examples, the machine operates as a standalone device ormay be connected (e.g., networked) to other machines. In a networkeddeployment, the machine may operate in the capacity of a server or aclient machine in a server-client network environment, or as a peermachine in a peer-to-peer (or distributed) network environment. Themachine may be a personal computer (PC), a tablet PC, a set-top box(STB), a Personal Digital Assistant (PDA), a cellular telephone, a webappliance, a network router, switch or bridge, or any machine capable ofexecuting instructions (sequential or otherwise) that specify actions tobe taken by that machine. Further, while only a single machine isillustrated, the term “machine” shall also be taken to include anycollection of machines that individually or jointly execute a set (ormultiple sets) of instructions to perform any one or more of themethodologies discussed herein.

The example computer system 2700 includes a processor 2702 (e.g., acentral processing unit (CPU), a graphics processing unit (GPU) orboth), a main memory 2704 and a static memory 2706, which communicatewith each other via a bus 2708. The computer system 2700 may furtherinclude a video display unit 2710 (e.g., a liquid crystal display (LCD)or a cathode ray tube (CRT)). The computer system 2700 also includes analphanumeric input device 2712 (e.g., a keyboard), a user interface (UI)navigation device 2714 (e.g., a mouse), a disk drive unit 2716, a signalgeneration device 2718 (e.g., a speaker) and a network interface device2720.

The disk drive unit 2716 includes a machine-readable medium 2722 onwhich is stored one or more sets of instructions and data structures(e.g., software) 2724 embodying or utilized by any one or more of themethodologies or functions described herein. The instructions 2724 mayalso reside, completely or at least partially, within the main memory2704 and/or within the processor 2702 during execution thereof by thecomputer system 2700, the main memory 2704 and the processor 2702 alsoconstituting machine-readable media.

While the machine-readable medium 2722 is shown in an example to be asingle medium, the term “machine-readable medium” may include a singlemedium or multiple media (e.g., a centralized or distributed database,and/or associated caches and servers) that store the one or moreinstructions or data structures. The term “machine-readable medium”shall also be taken to include any tangible medium that is capable ofstoring, encoding or carrying instructions for execution by the machineand that cause the machine to perform any one or more of themethodologies of the present invention, or that is capable of storing,encoding or carrying data structures utilized by or associated with suchinstructions. The term “machine-readable medium” shall accordingly betaken to include, but not be limited to, solid-state memories, andoptical and magnetic media. Specific examples of machine-readable mediainclude non-volatile memory, including by way of example semiconductormemory devices, e.g., Erasable Programmable Read-Only Memory (EPROM),Electrically Erasable Programmable Read-Only Memory (EEPROM), and flashmemory devices; magnetic disks such as internal hard disks and removabledisks; magneto-optical disks; and CD-ROM and DVD-ROM disks.

The instructions 2724 may further be transmitted or received over acommunications network 2726 using a transmission medium. Theinstructions 2724 may be transmitted using the network interface device2720 and any one of a number of well-known transfer protocols (e.g.,HTTP). Examples of communication networks include a local area network(“LAN”), a wide area network (“WAN”), the Internet, mobile telephonenetworks, Plain Old Telephone (POTS) networks, and wireless datanetworks (e.g., WiFi and WiMax networks). The term “transmission medium”shall be taken to include any intangible medium that is capable ofstoring, encoding or carrying instructions for execution by the machine,and includes digital or analog communications signals or otherintangible media to facilitate communication of such software.

The methodologies and systems described above may be performed by, andimplemented as, logic or a number of components, modules, or mechanisms.Modules may constitute either software modules (e.g., code embodied (1)on a non-transitory machine-readable medium or (2) in a transmissionsignal) or hardware-implemented modules. A hardware-implemented moduleis tangible unit capable of performing certain operations and may beconfigured or arranged in a certain manner. In examples, one or morecomputer systems (e.g., a standalone, client, or server computer system)or one or more processors may be configured by software (e.g., anapplication or application portion) as a hardware-implemented modulethat operates to perform certain operations as described herein.

In various examples, a hardware-implemented module may be implementedmechanically or electronically. For example, a hardware-implementedmodule may comprise dedicated circuitry or logic that is permanentlyconfigured (e.g., as a special-purpose processor, such as a fieldprogrammable gate array (FPGA) or an application-specific integratedcircuit (ASIC)) to perform certain operations. A hardware-implementedmodule may also comprise programmable logic or circuitry (e.g., asencompassed within a general-purpose processor or other programmableprocessor) that is temporarily configured by software to perform certainoperations. It will be appreciated that the decision to implement ahardware-implemented module mechanically, in dedicated and permanentlyconfigured circuitry, or in temporarily configured circuitry (e.g.,configured by software) may be driven by cost and time considerations.

Accordingly, the term “hardware-implemented module” should be understoodto encompass a tangible entity, be that an entity that is physicallyconstructed, permanently configured (e.g., hardwired) or temporarily ortransitorily configured (e.g., programmed) to operate in a certainmanner and/or to perform certain operations described herein.Considering examples in which hardware-implemented modules aretemporarily configured (e.g., programmed), each of thehardware-implemented modules need not be configured or instantiated atany one instance in time. For example, where the hardware-implementedmodules comprise a general-purpose processor configured using software,the general-purpose processor may be configured as respective differenthardware-implemented modules at different times. Software mayaccordingly configure a processor, for example, to constitute aparticular hardware-implemented module at one instance of time and toconstitute a different hardware-implemented module at a differentinstance of time.

Hardware-implemented modules can provide information to, and receiveinformation from, other hardware-implemented modules. Accordingly, thedescribed hardware-implemented modules may be regarded as beingcommunicatively coupled. Where multiple such hardware-implementedmodules exist contemporaneously, communications may be achieved throughsignal transmission (e.g., over appropriate circuits and buses) thatconnect the hardware-implemented modules. In examples in which multiplehardware-implemented modules are configured or instantiated at differenttimes, communications between such hardware-implemented modules may beachieved, for example, through the storage and retrieval of informationin memory structures to which the multiple hardware-implemented moduleshave access. For example, one hardware-implemented module may perform anoperation, and store the output of that operation in a memory device towhich it is communicatively coupled. A further hardware-implementedmodule may then, at a later time, access the memory device to retrieveand process the stored output. Hardware-implemented modules may alsoinitiate communications with input or output devices, and can operate ona resource (e.g., a collection of information).

The various operations of example methods described herein may beperformed, at least partially, by one or more processors that aretemporarily configured (e.g., by software) or permanently configured toperform the relevant operations. Whether temporarily or permanentlyconfigured, such processors may constitute processor-implemented modulesthat operate to perform one or more operations or functions. The modulesreferred to herein may, in some examples, comprise processor-implementedmodules.

Similarly, the methods described herein may be at least partiallyprocessor-implemented. For example, at least some of the operations of amethod may be performed by one or processors or processor-implementedmodules. The performance of certain of the operations may be distributedamong the one or more processors, not only residing within a singlemachine, but deployed across a number of machines. In some examples, theprocessor or processors may be located in a single location (e.g.,within a home environment, an office environment or as a server farm),while in other examples the processors may be distributed across anumber of locations.

The one or more processors may also operate to support performance ofthe relevant operations in a “cloud computing” environment or as a“software as a service” (SaaS). For example, at least some of theoperations may be performed by a group of computers (as examples ofmachines including processors), these operations being accessible via anetwork (e.g., the Internet) and via one or more appropriate interfaces(e.g., Application Program Interfaces (APIs).)

Although an example has been described with reference to specificexamples, it will be evident that various modifications and changes maybe made to these examples without departing from the broader spirit andscope of the invention. Accordingly, the specification and drawings areto be regarded in an illustrative rather than a restrictive sense. Theaccompanying drawings that form a part hereof, show by way ofillustration, and not of limitation, specific examples in which thesubject matter may be practiced. The examples illustrated are describedin sufficient detail to enable those skilled in the art to practice theteachings disclosed herein. Other examples may be utilized and derivedtherefrom, such that structural and logical substitutions and changesmay be made without departing from the scope of this disclosure. ThisDetailed Description, therefore, is not to be taken in a limiting sense,and the scope of various examples is defined only by the appendedclaims, along with the full range of equivalents to which such claimsare entitled.

Such examples of the inventive subject matter may be referred to herein,individually and/or collectively, by the term “invention” merely forconvenience and without intending to voluntarily limit the scope of thisapplication to any single invention or inventive concept if more thanone is in fact disclosed. Thus, although specific examples have beenillustrated and described herein, it should be appreciated that anyarrangement calculated to achieve the same purpose may be substitutedfor the specific examples shown. This disclosure is intended to coverany and all adaptations or variations of various examples. Combinationsof the above examples, and other examples not specifically describedherein, will be apparent to those of skill in the art upon reviewing theabove description.

We claim:
 1. A computer-implemented method for sharing informationrelated to a collaborative document hosted on a network storage service,the method comprising: storing a first snapshot of the collaborativedocument; receiving a first edit to the collaborative document from afirst user; modifying the collaborative document based on the firstedit; storing a second snapshot of the modified collaborative document;flattening, by a processor, the first snapshot into a firstone-dimensional string to result in a first flattened snapshot and thesecond snapshot into a second one-dimensional string to result in asecond flattened snapshot; and determining a change between thecollaborative document and the modified collaborative document based ona comparison of the first flattened snapshot and the second flattenedsnapshot.
 2. The method of claim 1, wherein determining the changebetween the collaborative document and the modified collaborativedocument comprises: determining a smallest subset of the secondflattened snapshot that is different from a corresponding subset of thefirst flattened snapshot.
 3. The method of claim 1, further comprising:generating a feed comprising a representation of the change; and sendingthe feed to a client device for display on the client device.
 4. Themethod of claim 1, further comprising: receiving a second edit to themodified collaborative document from a second user; further modifyingthe modified collaborative document based on the second edit; storing athird snapshot of the further modified collaborative document;flattening the third snapshot into a third one-dimensional string toresult in a third flattened snapshot; determining a further changebetween the modified collaborative document and the further modifiedcollaborative document based on a comparison of the second flattenedsnapshot and the third flattened snapshot; modifying a feed to include arepresentation of the further change; and sending the modified feed to aclient device for display on the client device
 5. The method of claim 1,further comprising: flattening the first snapshot into a fourthone-dimensional string to result in a fourth flattened snapshot;flattening the second snapshot into a fifth one-dimensional string toresult in a fifth flattened snapshot; and determining a second smallestsubset of the fifth flattened snapshot that is different from acorresponding subset of the fourth flattened snapshot, wherein thechange is identified in the second smallest subset.
 6. The method ofclaim 5, wherein the collaborative document is a spreadsheet document,wherein the fourth and fifth one-dimensional string each contain aplurality of identifiers, wherein each of the identifiers represents arow or column in the spreadsheet document.
 7. The method of claim 1,wherein each snapshot of the collaborative document comprises ahierarchy of nodes including a plurality of levels, one master node, anda plurality of non-master nodes containing data, wherein each of thenon-master nodes has a parent node in a level above, wherein each of thenodes has zero, one, or more child nodes in a level below, wherein anumber of levels between each node in a level and the master node is asame number, wherein flattening the first snapshot into the firstone-dimensional string comprises: selecting a level of the plurality oflevels; mapping a first node in the selected level to a firstidentifier; and adding the first identifier to the first one-dimensionalstring; and wherein flattening the second snapshot into the secondone-dimensional string comprises: mapping a second node in acorresponding selected level of the second snapshot to the firstidentifier, based on a determination that contents of the second nodeare the same as contents of the first node, and adding the firstidentifier to the second one-dimensional string.
 8. The method of claim7, wherein flattening the second snapshot into the secondone-dimensional string further comprises: mapping a third node in acorresponding selected level of the second snapshot to a secondidentifier based on a determination that the data contained in the thirdnode are different from contents of any of the nodes in the selectedlevel of the first snapshot; and adding the second identifier to thesecond one-dimensional string.
 9. A system for sharing informationrelated to a collaborative document hosted on a network storage service,comprising: a memory; and one or more processors, coupled to the memory,to: store a first snapshot of the collaborative document; receive afirst edit to the collaborative document from a first user; modify thecollaborative document based on the first edit; store a second snapshotof the modified collaborative document; flatten, by the one or moreprocessors, the first snapshot into a first one-dimensional string toresult in a first flattened snapshot and the second snapshot into asecond one-dimensional string to result in a second flattened snapshot;and determine a change between the collaborative document and themodified collaborative document based on a comparison of the firstflattened snapshot and the second flattened snapshot.
 10. The system ofclaim 9, wherein to determine the change between the collaborativedocument and the modified collaborative document, the one or moreprocessors to: determine a smallest subset of the second flattenedsnapshot that is different from a corresponding subset of the firstflattened snapshot.
 11. The system of claim 9, the one or moreprocessors further to: receive a second edit to the modifiedcollaborative document from a second user; further modify the modifiedcollaborative document based on the second edit; store a third snapshotof the further modified collaborative document; flatten the thirdsnapshot into a third one-dimensional string to result in a thirdflattened snapshot; determine a further change between the modifiedcollaborative document and the further modified collaborative documentbased on a comparison of the second flattened snapshot and the thirdflattened snapshot; and modify a feed to include a representation of thefurther change; and send the modified feed to a client device fordisplay on the client device.
 12. The system of claim 10, the one ormore processors further to: flatten the first snapshot into a fourthone-dimensional string to result in a fourth flattened snapshot; flattenthe second snapshot into a fifth one-dimensional string to result in afifth flattened snapshot; and determine a second smallest subset of thefifth flattened snapshot that is different from a corresponding subsetof the fourth flattened snapshot, wherein the determined smallest subsetis the second smallest subset.
 13. The system of claim 12, wherein thecollaborative document is a spreadsheet document, wherein the fourth andfifth one-dimensional string each contain a plurality of identifiers,wherein each of the identifiers represents a row or column in thespreadsheet document.
 14. The system of claim 10, wherein each snapshotof the collaborative document comprises a hierarchy of nodes including aplurality of levels, one master node, and a plurality of non-masternodes containing data, wherein each of the non-master nodes has a parentnode in a level above, wherein each of the nodes has zero, one, or morechild nodes in a level below, wherein a number of levels between eachnode in a level and the master node is a same number; wherein to flattenthe first snapshot into the first one-dimensional string, the one ormore processors to: select a level of the plurality of levels; map afirst node in the selected level to a first identifier; and add thefirst identifier to the first one-dimensional string; and wherein toflatten the second snapshot into the second one-dimensional string, theone or more processors to: map a second node in a corresponding selectedlevel of the second snapshot to the first identifier, based on adetermination that contents of the second node are the same as contentsof the first node; and add the first identifier to the secondone-dimensional string.
 15. The system of claim 14, wherein to flattenthe second snapshot into the second one-dimensional string further, theone or more processor to: map a third node in a corresponding selectedlevel of the second snapshot to a second identifier, based on adetermination that the data contained in the third node are differentfrom contents of any of the nodes in the selected level of the firstsnapshot; and add the second identifier to the second one-dimensionalstring.
 16. The system of claim 14, wherein to determine the smallestsubset, the one or more processors to: determine that the firstone-dimensional string and the second one-dimensional string contain thefirst identifier; and exclude the first identifier from the smallestsubset.
 17. The system of claim 15 wherein to determine the smallestsubset the one or more processors to: determine that the firstone-dimensional string does not contain the second identifier; andinclude the second identifier in the smallest subset.
 18. Anon-transitory computer-readable medium comprising instructions that,responsive to being executed by a processor, causing the processor toperform operations comprising: storing a first snapshot of acollaborative document; receiving a first edit to the collaborativedocument from a first user; modifying the collaborative document basedon the first edit; storing a second snapshot of the modifiedcollaborative document; flattening, by a processor, the first snapshotinto a first one-dimensional string to result in a first flattenedsnapshot and the second snapshot into a second one-dimensional string toresult in a second flattened snapshot; and determining a change betweenthe collaborative document and the modified collaborative document basedon a comparison of the first flattened snapshot and the second flattenedsnapshot.
 19. The non-transitory computer-readable medium of claim 18,wherein determining the change between the collaborative document andthe modified collaborative document comprises: determining a smallestsubset of the second flattened snapshot that is different from acorresponding subset of the first flattened snapshot.
 20. Thenon-transitory computer-readable medium of claim 18, further comprising:generating a feed comprising a representation of the change; and sendingthe feed to a client device for display on the client device.